group { name: "elm/menu/item/default";
   script {
      public menu_text_visible; //0:hide (default), 1:visible
      public menu_disable; //0:enable, 1:disable
   }
   parts {
      part { name: "base"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            color_class: "/bg/selected/menu/item/base";
            visible: 0;
         }
         description { state: "active" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
         description { state: "disabled" 0.0;
            inherit:  "default" 0.0;
         }
      }
      part { name: "elm.swallow.content"; type: SWALLOW; mouse_events:  0;
         clip_to: "disabler";
         scale: 1;
         description { state: "default" 0.0;
            min: 16 16;
            fixed: 1 0;
            align: 0.0 0.5;
            rel1.offset: 4 4;
            rel2.offset: 4 -5;
            rel2.relative: 0.0 1.0;
            offscale;
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      // XXX: check/radio goes next (right of) content, no radio/check handle
      // XXX: need to handle no text?
      // XXX: need arrowspace on/off based on submenus in menu
      part { name: "arrowspace"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: 15 15;
            max: 15 15;
            rel1.offset: -5 4;
            rel1.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            align: 1.0 0.5;
            offscale;
         }
      }
      part { name: "elm.text"; type: TEXT; mouse_events:  0;
         scale: 1;
         description { state: "default" 0.0;
            rel1.to_x: "elm.swallow.content";
            rel1.relative: 1.0 0.0;
            rel1.offset: 4 4;
            rel2.to_x: "arrowspace";
            rel2.offset: -5 -5;
            rel2.relative: 0.0 1.0;
            color_class: "/fg/normal/menu/item/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.0 0.5;
               text_class: "menu_item";
            }
         }
         description { state: "active" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/menu/item/text";
         }
         description { state: "disabled" 0.0;
            inherit:  "default" 0.0;
            color_class: "/fg/disabled/menu/item/text";
         }
      }
      part { name: "event"; type: RECT;
         ignore_flags: ON_HOLD;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "disabler"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 64; // no cc
         }
      }
   }
   programs {
      program { signal: "mouse,in"; source: "event";
         action: SIGNAL_EMIT "elm,action,activate" "elm";
         after: "selected";
      }
      program { signal: "mouse,out"; source: "event";
//         action: SIGNAL_EMIT "elm,action,inactivate" "elm";
         after: "unselected";
      }
      program { signal: "mouse,down,1"; source: "event";
         after: "selected";
      }
      program {
         signal: "mouse,up,1"; source: "event";
         action: SIGNAL_EMIT "elm,action,click" "elm";
      }
      program { signal: "elm,state,text,visible"; source: "elm";
         script {
            set_int(menu_text_visible, 1);
//            set_state(PART:"elm.text", "active", 0.0);
//            set_state(PART:"elm.text2", "active", 0.0);
         }
      }
      program { signal: "elm,state,text,hidden"; source: "elm";
         script {
            set_int(menu_text_visible, 0);
//            set_state(PART:"elm.text", "default", 0.0);
//            set_state(PART:"elm.text2", "default", 0.0);
         }
      }
      program { signal: "elm,state,icon,visible"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "elm.swallow.content";
      }
      program { signal: "elm,state,icon,hidden"; source: "elm";
         action: STATE_SET "noicon" 0.0;
         target: "elm.swallow.content";
      }
      program { name: "selected";
         signal: "elm,state,selected"; source: "elm";
         action: STATE_SET "active" 0.0;
         target: "base";
         target: "elm.text";
      }
      program { name: "unselected";
         signal: "elm,state,unselected"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
         target: "elm.text";
      }
      program { signal: "elm,state,enabled"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
         target: "event";
         target: "disabler";
         target: "elm.text";
      }
      program { signal: "elm,state,disabled"; source: "elm";
         action: STATE_SET "disabled" 0.0;
         target: "base";
         target: "event";
         target: "disabler";
         target: "elm.text";
      }
   }
}

group { name: "elm/menu/item_with_submenu/default";
   inherit: "elm/menu/item/default";
//   alias: "elm/menu/main_menu_submenu/default";
   parts {
      part { name: "arrow";
         description { state: "default" 0.0;
            min: 15 15;
            max: 15 15;
            rel.to: "arrowspace";
            image.normal: "i-arrow-r";
            color_class: "/fg/normal/menu/item/arrow";
         }
         description { state: "active" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/menu/item/arrow";
         }
      }
   }
   programs {
      program { name: "selected";
         target: "arrow";
      }
      program { name: "unselected";
         target: "arrow";
      }
      program { signal: "mouse,in"; source: "event";
         action: SIGNAL_EMIT "elm,action,open" "elm";
      }
//      program {
//         signal: "mouse,up,1"; source: "event";
//         action: SIGNAL_EMIT "elm,action,open" "elm";
//      }
   }
}

group { name: "elm/menu/separator/default";
   parts {
      part { name: "separator"; type: RECT;
         scale;
         description { state: "default" 0.0;
            rel1.offset: 0 10;
            rel2.offset: -1 -11;
            min: 0 1;
            color_class: "/fg/normal/separator/menu";
            offscale;
         }
      }
   }
}

group { name: "elm/menu/main_menu_submenu/default";
   script {
      public menu_text_visible; //0:hide (default), 1:visible
      public menu_disable; //0:enable, 1:disable
   }
   parts {
      part { name: "base"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            color_class: "/bg/selected/menu/item/base";
            visible: 0;
         }
         description { state: "active" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
         description { state: "disabled" 0.0;
            inherit:  "default" 0.0;
         }
      }
      part { name: "elm.swallow.content"; type: SWALLOW; mouse_events:  0;
         clip_to: "disabler";
         scale: 1;
         description { state: "default" 0.0;
            min: 16 16;
            fixed: 1 0;
            align: 0.0 0.5;
            rel1.offset: 4 4;
            rel2.offset: 4 -5;
            rel2.relative: 0.0 1.0;
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      // XXX: check/radio goes next (right of) content, no radio/check handle
      // XXX: need to handle no text?
      // XXX: need arrowspace on/off based on submenus in menu
      part { name: "arrowspace"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            fixed: 1 1;
            min: 15 15;
            max: 15 15;
            rel1.offset: -5 4;
            rel1.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            align: 1.0 0.5;
            offscale;
         }
      }
      part { name: "elm.text"; type: TEXT; mouse_events:  0;
         scale: 1;
         description { state: "default" 0.0;
            rel1.to_x: "elm.swallow.content";
            rel1.relative: 1.0 0.0;
            rel1.offset: 4 4;
            rel2.to_x: "arrowspace";
            rel2.offset: -5 -5;
            rel2.relative: 0.0 1.0;
            color_class: "/fg/normal/menu/item/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.0 0.5;
               text_class: "menu_item";
            }
         }
         description { state: "active" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/menu/item/text";
         }
         description { state: "disabled" 0.0;
            inherit:  "default" 0.0;
            color_class: "/fg/disabled/menu/item/text";
         }
      }
      part { name: "event"; type: RECT;
         ignore_flags: ON_HOLD;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "disabler"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 255;// no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 64; // no cc
         }
      }
   }
   programs {
      program { signal: "mouse,in"; source: "event";
         action: SIGNAL_EMIT "elm,action,activate" "elm";
         after: "selected";
      }
      program { signal: "mouse,out"; source: "event";
//         action: SIGNAL_EMIT "elm,action,inactivate" "elm";
         after: "unselected";
      }
      program { signal: "mouse,down,1"; source: "event";
         after: "selected";
      }
      program { signal: "mouse,down,1"; source: "event";
         action: SIGNAL_EMIT "elm,action,click" "elm";
      }
      program { signal: "elm,state,text,visible"; source: "elm";
         script {
            set_int(menu_text_visible, 1);
//            set_state(PART:"elm.text", "active", 0.0);
//            set_state(PART:"elm.text2", "active", 0.0);
         }
      }
      program { signal: "elm,state,text,hidden"; source: "elm";
         script {
            set_int(menu_text_visible, 0);
//            set_state(PART:"elm.text", "default", 0.0);
//            set_state(PART:"elm.text2", "default", 0.0);
         }
      }
      program { signal: "elm,state,icon,visible"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "elm.swallow.content";
      }
      program { signal: "elm,state,icon,hidden"; source: "elm";
         action: STATE_SET "noicon" 0.0;
         target: "elm.swallow.content";
      }
      program { name: "selected";
         signal: "elm,state,selected"; source: "elm";
         action: STATE_SET "active" 0.0;
         target: "base";
         target: "elm.text";
      }
      program { name: "unselected";
         signal: "elm,state,unselected"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
         target: "elm.text";
      }
      program { signal: "elm,state,enabled"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
         target: "event";
         target: "disabler";
         target: "elm.text";
      }
      program { signal: "elm,state,disabled"; source: "elm";
         action: STATE_SET "disabled" 0.0;
         target: "base";
         target: "event";
         target: "disabler";
         target: "elm.text";
      }
   }
}

//In the hover used by the menu only the bottom part is used.
group { name: "elm/hover/base/menu/default";
   images.image: "win_shad_angle.png" COMP;
   parts {
      part { name: "elm.swallow.offset"; type: SWALLOW;
         description { state: "default" 0.0;
            align: 0.0 0.0;
            fixed: 1 1;
            rel1.relative: 0.0 0.0;
            rel2.relative: 0.0 0.0;
         }
      }
      part { name: "elm.swallow.size"; type: SWALLOW;
         description { state: "default" 0.0;
            align: 0.0 0.0;
            fixed: 1 1;
            rel.to: "elm.swallow.offset";
            rel1.relative: 1.0 1.0;
         }
      }
      part { name: "base"; type: RECT; repeat_events: 1;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
      part { name: "elm.swallow.slot.left"; type: SWALLOW;
         description { state: "default" 0.0;
         }
      }
      part { name: "elm.swallow.slot.right"; type: SWALLOW;
         description { state: "default" 0.0;
         }
      }
      part { name: "elm.swallow.slot.top"; type: SWALLOW;
         description { state: "default" 0.0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
         }
      }
      part { name: "bottomclip"; type: RECT;
         scale;
         description { state: "default" 0.0;
            color: 255 255 255 0; // no cc
            rel1.offset: -200 -200;
            rel2.offset: 199 199;
            offscale;
            fixed: 1 1;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
      }
      WIN_SHAD("bg", "shadow", "win_shad_angle.png", 21, 21, 14, 28, 0.5)
      part { name: "shadow"; type: RECT;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            rel.to: "bg";
            rel1.offset: -1000 -1000;
            rel2.offset: 1000 1000;
            color_class: "/shadow/normal/menu";
         }
      }
      part { name: "bg"; type: RECT; mouse_events: 0;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            rel.to: "elm.swallow.slot.bottom";
            color_class: "/bg/normal/menu/base";
         }
      }

      part { name: "elm.swallow.slot.bottom"; type: SWALLOW;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            align: 0.5 0.0;
            fixed: 0 1;
            rel1.to: "elm.swallow.slot.middle";
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 0;
            rel2.to: "elm.swallow.slot.middle";
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
         }
      }
      part { name: "elm.swallow.slot.middle"; type: SWALLOW;
         repeat_events:1;
         description { state: "default" 0.0;
            rel.to: "elm.swallow.size";
         }
      }
   }
   programs {
      program { signal: "mouse,up,*"; source: "base";
         action: SIGNAL_EMIT "elm,action,dismiss" "elm";
      }
      program { signal: "elm,action,slot,bottom,show"; source: "elm";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.2;
         target: "bottomclip";
         target: "elm.swallow.slot.bottom";
      }
      program { signal: "elm,action,slot,bottom,hide"; source: "elm";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.5;
         target: "bottomclip";
         target: "elm.swallow.slot.bottom";
      }
   }
}

//In the hover used by the submenu only the bottom part is used
//and no part should interact except the bottom area
group { name: "elm/hover/base/submenu/default";
   inherit: "elm/hover/base/menu/default";
   parts {
      part { name: "elm.swallow.offset";
         repeat_events: 1;
      }
      //here we don't catch events like the hover does
      part { name: "base"; type: RECT; repeat_events: 1;
         description { state: "visible" 0.0;
            color: 0 0 0 0; // no cc
            visible: 0;
         }
      }
   }
}

group { name: "elm/hover/base/main_menu/default";
   parts {
      part { name: "elm.swallow.offset"; type: SWALLOW;
         description { state: "default" 0.0;
            visible: 0;
            fixed: 1 1;
         }
      }
      part { name: "elm.swallow.size"; type: SWALLOW;
         description { state: "default" 0.0;
            align: 0.0 0.0;
            rel2.relative: 0.0 0.0;
            rel1.offset: 0 0;
            fixed: 1 1;
         }
      }
      part { name: "bottomclip"; type: RECT;
         description { state: "default" 0.0;
            rel1.offset: -1 -2;
         }
      }
      part { name: "base"; type: RECT;
         description { state: "default" 0.0;
            rel1.to_y: "bottom";
            rel2.to_y: "bottom";
            color_class: "/bg/normal/menu/bar";
         }
      }
      part { name: "bottom"; type: RECT;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            visible: 0;
            rel.to: "elm.swallow.slot.bottom";
         }
      }
      part { name: "elm.swallow.slot.bottom"; type: SWALLOW;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            align: 0.5 0.0;
            fixed: 0 1;
            rel.to: "elm.swallow.size";
            rel1.relative: 0.0 1.0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
         }
      }
   }
   programs {
      program { name: "bottomshow";
         signal: "elm,action,slot,bottom,show"; source: "elm";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.3;
         target: "elm.swallow.slot.bottom";
      }
   }
}

group { name: "elm/hover/base/main_menu_submenu/default";
   images.image: "win_shad_angle.png" COMP;
   parts {
      part { name: "elm.swallow.offset"; type: SWALLOW;
         repeat_events:1;
         description { state: "default" 0.0;
            align: 0.0 0.0;
            fixed: 1 1;
            rel2.relative: 0.0 0.0;
         }
      }
      part { name: "elm.swallow.size"; type: SWALLOW;
         description { state: "default" 0.0;
            align: 0.0 0.0;
            fixed: 1 1;
            rel.to: "elm.swallow.offset";
            rel1.relative: 1.0 1.0;
         }
      }
      part { name: "base"; type: RECT; repeat_events: 1;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
      part { name: "bottomclip"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 0; // no cc
            rel1.offset: -200 -200;
            rel2.offset: 199 199;
            offscale;
            fixed: 1 1;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
      }
      WIN_SHAD("bg", "shadow", "win_shad_angle.png", 21, 21, 14, 28, 0.5)
      part { name: "shadow"; type: RECT;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            rel.to: "bg";
            rel1.offset: -1000 -1000;
            rel2.offset: 1000 1000;
            color_class: "/shadow/normal/menu";
         }
      }
      part { name: "bg"; type: RECT; mouse_events: 0;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            rel.to: "elm.swallow.slot.bottom";
            color_class: "/bg/normal/menu/base";
         }
      }
      part { name: "elm.swallow.slot.bottom"; type: SWALLOW;
         clip_to: "bottomclip";
         description { state: "default" 0.0;
            align: 0.5 1.0;
            fixed: 0 1;
            rel1.to: "elm.swallow.slot.middle";
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 0;
            rel2.to: "elm.swallow.slot.middle";
            rel2.relative: 1.0 1.0;
            rel2.offset: -1 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            rel1.offset: 0 6;
            rel2.offset: -1 6;
            align: 0.5 0.0;
         }
      }
      part { name: "pop"; type: RECT; mouse_events: 1;
         repeat_events:1;
         description { state: "default" 0.0;
            fixed: 0 1;
            rel1.to: "elm.swallow.slot.middle";
            rel1.offset: 0 0;
            rel2.to: "elm.swallow.slot.middle";
            rel1.relative: 0.0 1.0;
            rel2.offset: -1 0;
            visible: 0;
         }
      }
      part { name: "elm.swallow.slot.middle"; type: SWALLOW;
         repeat_events:1;
         description { state: "default" 0.0;
            rel.to: "elm.swallow.size";
         }
      }
   }
   programs {
      program { signal: "mouse,up,*"; source: "base";
         action: SIGNAL_EMIT "elm,action,dismiss" "elm";
      }
      program { signal: "elm,action,show"; source: "elm";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.2;
         target: "bottomclip";
      }
      program { signal: "elm,action,hide"; source: "elm";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.5;
         target: "bottomclip";
      }
      program { signal: "elm,action,slot,bottom,show"; source: "elm";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.2;
         target: "elm.swallow.slot.bottom";
      }
      program { signal: "elm,action,slot,bottom,hide"; source: "elm";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.5;
         target: "elm.swallow.slot.bottom";
      }
   }
}

